//
//  XJMeTableViewCell.m
//  XinJiangMall
//
//  Created by Tzyang on 2018/4/3.
//  Copyright © 2018年 Tzyang. All rights reserved.
//

#import "XJMeTableViewCell.h"

@implementation XJMeTableViewCell

#pragma mark -  一 lazy
- (UILabel *)yuELb
{
    if (!_yuELb) {
        _yuELb = [UILabel new];
//        _yuELb.backgroundColor = [UIColor blueColor];
        _yuELb.font = XJFONTSET_R(15.0);
        _yuELb.hidden = YES;
        [self addSubview:_yuELb];
    }
    return _yuELb;
}

+ (instancetype)cellWithTableView:(UITableView *)tableView{
    
    static NSString * cellId = @"XJMeTableViewCell";
    XJMeTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellId];
    if (cell==nil) {
        cell = [[XJMeTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];
        cell.backgroundColor = WHITE_COLOR;
    }
    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setupSubviews];
    }
    return self;
    
}

- (UIImageView *)indicator{
    if (!_indicator) {
        UIImageView * indicator = [UIImageView new];
        self.indicator = indicator;
        [self.contentView addSubview:indicator];
    }
    return _indicator;
    
}

- (UIImageView *)xjme_cellImgV{
    
    if (!_xjme_cellImgV) {
        UIImageView * xjme_cellImgV = [UIImageView new];
        self.xjme_cellImgV  = xjme_cellImgV;
        [self.contentView addSubview:xjme_cellImgV];
    }
    return _xjme_cellImgV;
}

- (UILabel *)xjme_cellLab{
    
    if (!_xjme_cellLab) {
        UILabel * xjme_cellLab = [UILabel  new];
        self.xjme_cellLab = xjme_cellLab;
        [self.contentView addSubview:xjme_cellLab];
    }
    return _xjme_cellLab;
}

- (void)setupSubviews{
    
    self.xjme_cellImgV.sd_layout
    .leftSpaceToView(self.contentView, ADAPTWidth(25))
    .centerYEqualToView(self.contentView)
    .widthIs(20)
    .heightIs(20);
    
    self.xjme_cellLab.font = XJFONTSET_R(14);
    self.xjme_cellLab.textColor = XJCOLOR_RGB(17, 17, 17);
    self.xjme_cellLab.sd_layout
    .leftSpaceToView(self.xjme_cellImgV, ADAPTWidth(10))
    .centerYEqualToView(self.contentView)
    .widthIs(ADAPTWidth(70))
    .heightIs(ADAPTHeight(20));
    
    
    self.indicator.image= [UIImage imageNamed:@"direction_right_black"];
    self.indicator.sd_layout
    .centerYEqualToView(self.contentView)
    .rightSpaceToView(self.contentView, ADAPTWidth(26))
    .widthIs(12)
    .heightIs(12);
    
    
    self.yuELb.sd_layout.
    centerYEqualToView(self.contentView)
    .rightSpaceToView(self.indicator, ADAPTWidth(5))
    .widthIs(80)
    .heightIs(30);
    
    
    NSString *yE =  [NSString stringWithFormat:@"%.2f",[[XJUserModel xj_balance] floatValue]];
    
    if([NSString isEmptyString:yE]) return;
    
    self.yuELb.text = yE;
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
